/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 sagyf Yang. The Four Group.
 */

package app.controllers.admin;

import app.models.activity.MallActivityStat;
import app.models.brand.DailyStat;
import com.github.sog.controller.BasicController;
import com.jfinal.core.ActionKey;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import java.util.List;

/**
 * <p>
 * .
 * </p>
 *
 * @author sagyf yang
 * @version 1.0 2014-04-09 22:22
 * @since JDK 1.6
 */
public class HomeController extends BasicController {

    /**
     * The index route.
     */
    public void index() {
        //品牌每日访问
        List<DailyStat> dailyBrand = DailyStat.dao.getDaiyTop();
        setAttr("dailyBrand",dailyBrand);
        //商场活动访问
        List<MallActivityStat> mallTimes = MallActivityStat.dao.getTopTimes();
        setAttr("mallTimes",mallTimes);
        render("index.ftl");
    }




    @ActionKey("/admin/logout")
    public void logout(){
        Subject subject = SecurityUtils.getSubject();
        if (subject != null) {
            subject.logout();
        }
        redirect("/admin/login");
    }


    @ActionKey("/admin/about")
    public void aboutme(){
        render("about.ftl");
    }

}